<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <base href="#(ctx_path)/"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登陆</title>
    <link rel="stylesheet" href="static/admin/layui/css/layui.css">
</head>
<body>
<div class="body">
    <div id="login" class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">登陆</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form" action="/admin/login" style="margin-top: 30px;">
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户名</label>
                        <div class="layui-input-block">
                            <input type="text" name="user" required lay-verify="required" placeholder="请输入用户名"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="login">登陆</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<script src="static/admin/layui/layui.js"></script>
<script>
    layui.config({
        base: 'static/admin/'
        , version: '0.0.1'
    }).extend({
        comm: 'lib/comm'
    }).use(['jquery', 'element', 'comm', 'form', 'layer'], function () {
        var form = layui.form,
                $ = layui.$,
                layer = layui.layer,
                comm = layui.comm,
                element = layui.element;
        //监听提交
        form.on('submit(login)', function (data) {
            comm.post("admin/login", data.field)
                    .success(function (ret) {
                        window.location.href = ret.data;
                    })
                    .run();
            return false;
        });
    })
</script>
<style>
    body {
        background: #dedede;
    }

    .body {
        width: 100%;
        height: 100%;
        position: absolute;
    }

    #login {
        width: 360px;
        margin: 40px auto;
        padding: 40px;
        background: #ffffff;
        min-height: 280px;
    }
</style>
</html>